package com.rentplant.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.rentplant.Pojo.rental;
import com.rentplant.Pojo.rentalanduser;
import com.rentplant.mapper.rentalMapper;
import com.rentplant.service.rentalService;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class rentalServiceImp implements rentalService {
    @Autowired
    private rentalMapper rentalmapper;


    //新增租房信息
    @Override
    public boolean addRental(JSONObject rentalinfo){
        return  rentalmapper.addRental(rentalinfo);
    }

    //查询最新租房信息
    @Override
    public List<rentalanduser> rentalByNew(){
        return rentalmapper.rentalByNew();
    }
    //查询最热租房信息
    public List<rentalanduser> rentalByHot(){return rentalmapper.rentalByHot();}
    //查询价格最高的租房信息
    @Override
    public List<rentalanduser> rentalByHigh(){
        return rentalmapper.rentalByHigh();
    }
    //查询价格最低的租房信息
    public List<rentalanduser> rentalByLow(){
        return rentalmapper.rentalByLow();
    }

    //按照id查询租房信息
    @Override
    public List<rentalanduser> rentalById(JSONObject rentalinfo){
        return rentalmapper.rentalById(rentalinfo);
    }

    //更新浏览量
    @Override
    public  boolean updateSee(JSONObject rentalinfo){
        return rentalmapper.updateSee(rentalinfo);
    }

    //展示用户的租房信息
    @Override
    public  List<rental> showUserRental(JSONObject rentalinfo){
        return rentalmapper.showUserRental(rentalinfo);
    }

    //    展示用户已删除租房信息
    @Override
    public  List<rental> delHaveRental(JSONObject rentalinfo){
        return rentalmapper.delHaveRental(rentalinfo);
    }

    //    重新上架用户租房信息
    @Override
    public boolean rentalState(JSONObject rentalinfo){
        return rentalmapper.rentalState(rentalinfo);
    }

    //删除用户发布的租房信息
    @Override
    public boolean changeRentalState(JSONObject rentalinfo){
        return rentalmapper.changeRentalState(rentalinfo);
    }



    //    租房管理端
    @Override
    public List<rental> allRental(JSONObject pageInfo){return rentalmapper.allRental(pageInfo);}
    @Override
    public List<rental> allRentals(){return rentalmapper.allRentals();}

    //    修改租房信息
    @Override
    public boolean updateRental(JSONObject rentalInfo){return rentalmapper.updateRental(rentalInfo);}

    //    条件查询
    @Override
    public List<rental> partRental(JSONObject searchinfo){return rentalmapper.partRental(searchinfo);}
    //    条件查询
    @Override
    public List<rental> partRentals(JSONObject searchinfo){return rentalmapper.partRentals(searchinfo);}
}
